home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / gfx / x11 / x3270_3_2_16.lha / amiga_src / screen.h < prev    next >
C/C++ Source or Header  |  2007-03-01  |  2KB  |  73 lines

  1. /*
  2.  * Modifications Copyright 1993, 1994, 1995, 1999 by Paul Mattes.
  3.  * Original X11 Port Copyright 1990 by Jeff Sparkes.
  4.  *  Permission to use, copy, modify, and distribute this software and its
  5.  *  documentation for any purpose and without fee is hereby granted,
  6.  *  provided that the above copyright notice appear in all copies and that
  7.  *  both that copyright notice and this permission notice appear in
  8.  *  supporting documentation.
  9.  *
  10.  * Copyright 1989 by Georgia Tech Research Corporation, Atlanta, GA 30332.
  11.  *  All Rights Reserved.  GTRC hereby grants public use of this software.
  12.  *  Derivative works based on this software must incorporate this copyright
  13.  *  notice.
  14.  */
  15.  
  16. /*
  17.  *    screen.h
  18.  *
  19.  *        Screen definitions for x3270.
  20.  */
  21.  
  22. #define fCHAR_WIDTH(f)    ((f)->max_bounds.width)
  23. #define fCHAR_HEIGHT(f)    ((f)->ascent + (f)->descent)
  24.  
  25. #define HHALO    2    /* number of pixels to pad screen left-right */
  26. #define VHALO    1    /* number of pixels to pad screen top-bottom */
  27.  
  28. #define cwX_TO_COL(x_pos, cw)     (((x_pos)-HHALO) / (cw))
  29. #define chY_TO_ROW(y_pos, ch)     (((y_pos)-VHALO) / (ch))
  30. #define cwCOL_TO_X(col, cw)    (((col) * (cw)) + HHALO)
  31. #define chROW_TO_Y(row, ch)    (((row)+1) * (ch) + VHALO)
  32.  
  33. #define ssX_TO_COL(x_pos)     cwX_TO_COL(x_pos, ss->char_width)
  34. #define ssY_TO_ROW(y_pos)     chY_TO_ROW(y_pos, ss->char_height)
  35. #define ssCOL_TO_X(col)        cwCOL_TO_X(col, ss->char_width)
  36. #define ssROW_TO_Y(row)        chROW_TO_Y(row, ss->char_height)
  37.  
  38. #define X_TO_COL(x_pos)     cwX_TO_COL(x_pos, *char_width)
  39. #define Y_TO_ROW(y_pos)     chY_TO_ROW(y_pos, *char_height)
  40. #define COL_TO_X(col)        cwCOL_TO_X(col, *char_width)
  41. #define ROW_TO_Y(row)        chROW_TO_Y(row, *char_height)
  42.  
  43. #define SGAP    (*descent+3)     /* gap between screen and status line */
  44.  
  45. #define SCREEN_WIDTH(cw)    (cwCOL_TO_X(maxCOLS, cw) + HHALO)
  46. #define SCREEN_HEIGHT(ch)    (chROW_TO_Y(maxROWS, ch) + VHALO+SGAP+VHALO)
  47.  
  48. /* selections */
  49.  
  50. #define SELECTED(baddr)        (selected[(baddr)/8] & (1 << ((baddr)%8)))
  51. #define SET_SELECT(baddr)    (selected[(baddr)/8] |= (1 << ((baddr)%8)))
  52.  
  53. /*
  54.  * Screen position structure.
  55.  */
  56. union sp {
  57.     struct {
  58.         unsigned cg  : 8;    /* character code */
  59.         unsigned sel : 1;    /* selection status */
  60.         unsigned fg  : 6;    /* foreground color (flag/inv/0-15) */
  61.         unsigned gr  : 4;    /* graphic rendition */
  62.         unsigned cs  : 3;    /* character set */
  63.     } bits;
  64.     unsigned long word;
  65. };
  66.  
  67. /*
  68.  * screen.c data structures. *
  69.  */
  70. extern int     *char_width, *char_height;
  71. extern unsigned char *selected;        /* selection bitmap */
  72. extern int     *ascent, *descent;
  73.